package com.ckv.qcm.model;

import java.sql.SQLException;
import java.util.Date;

import com.ckv.qcm.model.dao.SessionDAO;

public class Session
{

	private long idSession;
	private long idtest;
	private Test test = null;
	private Date dateDebut = null;
	private Date dateFin = null;

	private static SessionDAO dao = new SessionDAO();

	public Session()
	{
		super();
	}

	public Date getDateFin()
	{
		return dateFin;
	}

	public void setDateFin(Date dateFin)
	{
		this.dateFin = dateFin;
	}

	public Session(long idSession, long idtest,Date dateDebut, Date dateFin)
	{
		super();
		this.idSession = idSession;
		this.idtest = idtest;
		this.dateDebut = dateDebut;
		this.dateFin = dateFin;
	}

	public void loadTest() throws SQLException
	{
		this.test = Test.find(this.idtest);
	}

	public static Session find(long id)
	{
		return dao.find(id);
	}

	public long getIdSession()
	{
		return idSession;
	}

	public void setIdSession(long idSession)
	{
		this.idSession = idSession;
	}

	public long getIdtest()
	{
		return idtest;
	}

	public void setIdtest(long idtest)
	{
		this.idtest = idtest;
	}
	
	public Date getDateDebut()
	{
		return dateDebut;
	}

	public void setDateDebut(Date dateDebut)
	{
		this.dateDebut = dateDebut;
	}

}
